"""扫描任务Schema"""
from typing import Optional
from pydantic import BaseModel, Field
from datetime import datetime


class ScanTaskBase(BaseModel):
    """扫描任务基础Schema"""
    name: str = Field(..., description="任务名称", max_length=100)
    task_type: str = Field(..., description="任务类型标识", max_length=50)
    description: Optional[str] = Field(None, description="任务描述")
    status: str = Field("enabled", description="状态: enabled/disabled")


class ScanTaskCreate(ScanTaskBase):
    """创建扫描任务Schema"""
    pass


class ScanTaskUpdate(BaseModel):
    """更新扫描任务Schema"""
    name: Optional[str] = Field(None, description="任务名称", max_length=100)
    description: Optional[str] = Field(None, description="任务描述")
    status: Optional[str] = Field(None, description="状态: enabled/disabled")


class ScanTaskResponse(ScanTaskBase):
    """扫描任务响应Schema"""
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True

